#if !USE_CONSOLE

#ifndef MATERIAL_DIALOG_H
#define MATERIAL_DIALOG_H

#include <QDialog>
#include <QtGui>
#include <iostream>
#include "src/interface/glwidget.h"

class MaterialDialog : public QDialog{
    Q_OBJECT

    public:
        MaterialDialog(GLWidget * = NULL, QWidget * = 0);
        ~MaterialDialog();

    signals:
//        void setAmbientR(double);
//        void setAmbientG(double);
//        void setAmbientB(double);
//        void setAmbientA(double);
//        void setDiffuseR(double);
//        void setDiffuseG(double);
//        void setDiffuseB(double);
//        void setDiffuseA(double);
//        void setSpecularR(double);
//        void setSpecularG(double);
//        void setSpecularB(double);
//        void setSpecularA(double);
        void setSpecularPower(double);
        void setKa(double);
        void setKd(double);
        void setKs(double);
        void setKt(double);
        void setRepeatTextureU(int);
        void setRepeatTextureV(int);
        void setRepeatBumpMappingU(int);
        void setRepeatBumpMappingV(int);
        void setBumpMappingIntensity(double);
        void setRefractiveIndex(double);
        void changed(int);

    protected:
        int ambientR, ambientG, ambientB, ambientA, diffuseR, diffuseG, diffuseB, diffuseA, specularR, specularG, specularB, specularA;
        double specularPower, ka, kd, ks, kt, refractiveIndex;
        QString textureFilePath;
        int textureRepeatTimesU, textureRepeatTimesV, textureColoringType, textureMappingType;
        QString bumpMappingFilePath;
        double bumpMappingIntensity;
        int bumpMappingRepeatTimesU, bumpMappingRepeatTimesV, bumpMappingMappingType;
        bool inMaterial, useTexture, useBumpMapping, bumpMappingLoop;

        GLWidget *glWidget;

        QPushButton *ambientPushButton;
        QPushButton *diffusePushButton;
        QPushButton *specularPushButton;
        QPushButton *texturePushButton;
        QPushButton *bumpMappingPushButton;
        QComboBox *materialTypeComboBox;

        void createMaterialLayout(QVBoxLayout *);
        void setButtonColor();
        void setButtonTexture();
        void setButtonBumpMapping();

    private slots:
        void change(double = 0){if(!inMaterial){emit changed(0);}};
        void changeint(int = 0){if(!inMaterial){emit changed(0);}};
        void activateTexture(bool _b) {useTexture = _b;};
        void activateBumpMapping(bool _b) {useBumpMapping = _b;};
        void changeAmbient();
        void changeDiffuse();
        void changeSpecular();
        void changeTexture();
        void changeBumpMapping();
        void changeKa(double _k) {ka = _k;};
        void changeKd(double _k) {kd = _k;};
        void changeKs(double _k) {ks = _k;};
        void changeKt(double _k) {kt = _k;};
        void changeTextureRepeatU(int _u) {textureRepeatTimesU = _u;};
        void changeTextureRepeatV(int _v) {textureRepeatTimesV = _v;};
        void changeBumpMappingRepeatU(int _u) {bumpMappingRepeatTimesU = _u;};
        void changeBumpMappingRepeatV(int _v) {bumpMappingRepeatTimesV = _v;};
        void changeSpecularPower(double _sp) {specularPower = _sp;};
        void changeRefractiveIndex(double);
        void changeTextureColoringType(int _t){textureColoringType = _t;};
        void changeTextureMappingType(int _t){textureMappingType = _t;};
        void changeBumpMappingMappingType(int _t){bumpMappingMappingType = _t;};
        void changeBumpMappingIntensity(double _t){bumpMappingIntensity = _t;};
        void changeMaterialType(int);
};

#endif

#endif //!USE_CONSOLE
